{include file="public/header" /}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.css"}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.js"}
<style>
    .asljasd .col-sm-9,.asljasd .col-sm-3{
        font-size: 14px;
        padding:5px 15px;
    }
    .form-group{
        overflow: hidden;
    }
    .col-sm-6{
        margin-bottom: 30px;
    }
    .ibox-content{
        height: 260px;
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content {:config('adminClass.main')}">
    <div class="col-sm-6">
        <div class="ibox-title">
            <h5>付款信息</h5>
        </div>
        <div class="ibox-content">
            <div class="row asljasd">
                <div class="col-sm-12">
                    <div class="col-sm-3">订单号：</div>
                    <div class="col-sm-9">{$name.number}</div>
                </div>
                <div class="col-sm-12">
                    <div class="col-sm-3">商品总金额：</div>
                    <div class="col-sm-9">{:_money($name.data.price * $name.num)}元</div>
                </div>
                <div class="col-sm-12">
                    <div class="col-sm-3">支付金额：</div>
                    <div class="col-sm-9" style="color:red">{:_money($name.price)}元</div>
                </div>
                {if condition="$name.coupon"}
                <div class="col-sm-12">
                    <div class="col-sm-3">优惠券ID：</div>
                    <div class="col-sm-9">{$name.coupon.id}</div>
                </div>
                <div class="col-sm-12">
                    <div class="col-sm-3">优惠券抵扣：</div>
                    <div class="col-sm-9">{:_money($name.coupon.price)}元</div>
                </div>
                {/if}
                <div class="col-sm-12">
                    <div class="col-sm-3">创建时间：</div>
                    <div class="col-sm-9">{$name.create_time}</div>
                </div>
                {if condition="$name.paystate == 1"}
                <div class="col-sm-12">
                    <div class="col-sm-3">支付时间：</div>
                    <div class="col-sm-9">{$name.pay_time}</div>
                </div>
                <div class="col-sm-12">
                    <div class="col-sm-3">失效时间：</div>
                    <div class="col-sm-9">{$name.expire_time}</div>
                </div>
                {/if}
              <!--   <div class="col-sm-12">
                    <div class="col-sm-3">使用状态：</div>
                    <div class="col-sm-9">
                        {switch name="name.status"}
                        {case value="-1"}<span class='btn btn-default btn-xs'>已失效</span>{/case}
                        {case value="1"}<span class='btn btn-primary btn-xs'>已使用</span>{/case}
                        {default /}<span class='btn btn-default btn-xs'>待使用</span>
                        {/switch}
                    </div>
                </div>
                <div class="col-sm-12">
                    <div class="col-sm-3">支付状态：</div>
                    <div class="col-sm-9">
                        {switch name="name.paystate"}
                        {case value="-1"}<span class='btn btn-default btn-xs'>已失效</span>{/case}
                        {case value="1"}<span class='btn btn-primary btn-xs'>已支付</span>{/case}
                        {default /}<span class='btn btn-default btn-xs'>待支付</span>
                        {/switch}
                    </div>
                </div> -->
            </div>
        </div>
    </div>
    <div class="col-sm-6">
        <div class="ibox-title">
            <h5>商品信息</h5>
        </div>
        <div class="ibox-content">
                <div class="row asljasd">
                <a  class="col-sm-12" style="display: flex;align-items: center;">
                    <div class="col-sm-3"><img src="__ROOT__{$name.image}" alt="" width="100%" height="100%"></div>
                    <div style="display: flex;align-items: center;width: 75%;justify-content: space-between;">
                        <div class="col-sm-3">商品ID: {$name.good_id}</div>
                        <div class="col-sm-3">{:_substr($name.name)}</div>
                        <div class="col-sm-3">{:_money($name['data']['price'])}</div>
                        <div class="col-sm-3">{$name.num}件</div>
                    </div>
                </a>
            </div>
        </div>
    </div>
    <div class="col-sm-6">
        <div class="ibox-title">
            <h5>用户资料</h5>
        </div>
        <div class="ibox-content">
            <div class="row m-b-lg">
                <div class="col-lg-8">
                    <ul class="list-group clear-list">
                        <li class="list-group-item fist-item">
                            <span class="pull-right"> {$name.member.id}</span> 用户ID:
                        </li>
                        <li class="list-group-item fist-item">
                            <span class="pull-right"> {$name.member.name}</span> 昵称
                        </li>
                        <li class="list-group-item">
                            <span class="pull-right"> {$name.member.phone} </span> 手机：
                        </li>
                    </ul>
                </div>
                <div class="col-lg-4 text-center">
                    <div class="m-b-sm">
                        <img alt="image" class="img-circle" src="__ROOT__{$name.member.head_100}" style="width: 62px">
                    </div>
                </div>
            </div>
        </div>
    </div>
    {if condition="$name.status == 1"}
    <div class="col-sm-6">
        <div class="ibox-content">
            <div class="form-group">
                <label class="col-sm-3 control-label">使用状态设置</label>
                <div class="col-sm-4">
                    <select class="form-control" name="status">
                        <option value="-1" {eq name='name.status' value="-1" }selected{/eq}>已失效</option>
                        <option value="0" {eq name='name.status' value="0" }selected{/eq}>待使用</option>
                        <option value="1" {eq name='name.status' value="1" }selected{/eq}>已使用</option>
                    </select>
                </div>
            </div>
            <div style="clear: both; margin: 20px auto; width: 180px;"><div style="width: 100%" class="btn btn-primary" id="data">提交</div></div>
        </div>
    </div>
    {/if}
</div>
{include file="public/footer" /}
<script type="text/javascript">
    $(document).ready(function(){
        $('#data').click(function(){
            var status = $("select[name='status']").val();

            $.ajax({
                type: 'post',
                url: '{:url('setOrderStatus')}',
                data: {
                    status:status,
                    id:{$name.id}
                },
                dataType: 'json',
                success:function(ret){
                    if (ret.ret) {
                        swal_msg(ret.ret,'',"success",0)
                    } else {
                        layer.msg(ret.err)
                    }
                },
            });
        })

    });
</script>
 